<?php

	function printRow($name, $number) {
		echo "<tr>";
		echo "<td> $name </td>";
		echo "<td> $number </td>";
		echo "</tr>";
	}
	
	session_start();
	include("./dbconnect.php");
	$con = new dbconnect();
	$con->connect();
	
	echo "Recieved: ".$_POST['pName']." and ".$_POST['pNumber']."<br>";
	
	if(isset($_POST['submit'])) {
		echo "did pass submit...<br>";
		$sSql = "INSERT INTO AndroidTest (name, number)
							VALUES ('".$_POST['pName']."',
									'".$_POST['pNumber']."')
							";
		
		echo "Query: ".$sSql."<br>";
		mysql_query($sSql);
		$update = mysql_affected_rows();
		echo "$update rows updated";
	}
	
	echo "<table>";
	
	$result = mysql_query("SELECT * FROM HttpPostTest");
	echo "SELECT * FROM AndroidTest";
	while($row = mysql_fetch_array($result)) {
		printRow($row[0], $row[1]);
	}
	echo "</table>";
?>

<form name="input" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
name: <input type="text" name="pName"><br>
number: <input type="text" name="pNumber"><br>
<input type="submit" name ="submit" value="Submit">
</form>